package chapter_8.set;

import java.util.Objects;

public class Cat {
    private String name;
    private int age;
    public Cat(String name, int age){
        this.name = name;
        this.age = age;
    }
    @Override
    public boolean equals(Object o) {
        Cat cat = (Cat) o;
        return age == cat.age && Objects.equals(name, cat.name);
    }
    @Override
    public int hashCode() {//sjlfjsl  ->  483538038
        return Objects.hash(name, age);
    }
    @Override
    public String toString() {
        return "Cat{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
    public Cat(){
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
}
